<%@ page import="java.util.List" %>
<%@ page import="com.foreknow.model.Guestbook" %>
<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2024/8/28
  Time: 9:35
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <link rel="stylesheet" href="/WebManagerSystem/css/bootstrap.min.css">
</head>
<body>
<div class="container">

    <table class="table table-hover">
        <tr>
            <td>id</td>
            <td>name</td>
            <td>pass</td>
            <td>phone</td>
            <td>email</td>
            <td>title</td>
            <td>content</td>
            <td>createdtime</td>
            <td>操作</td>
        </tr>
        <%
            //可以写Java代码
            //需要从request中获取到list集合(根据key来获取)
            List<Guestbook> list = (List<Guestbook>) session.getAttribute("list");
            for (int i = 0;i<list.size();i++) {
                Guestbook gb = list.get(i);
        %>
        <tr>
            <td><%=gb.getId()%></td>
            <td><%=gb.getName()%></td>
            <td><%=gb.getPass()%></td>
            <td><%=gb.getPhone()%></td>
            <td><%=gb.getEmail()%></td>
            <td><%=gb.getTitle()%></td>
            <td><%=gb.getContent()%></td>
            <td><%=gb.getCreatedtime()%></td>
            <td>
                <a href="manager?id=<%=gb.getId()%>&q=update" class="btn btn-primary">修改</a>
                <a href="manager?id=<%=gb.getId()%>&q=delete" class="btn btn-danger">删除</a>
            </td>
        </tr>
        <%
            }
        %>

    </table>
</div>

</body>
</html>
